package com.card.entity.system;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.NotBlank;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

/** 
 * ClassName: Customer <br/> 
 * Function: 样本数据. <br/> 
 * date: 2018年12月11日 上午10:49:18 <br/> 
 * 
 * @author lishuai11 
 * @version  
 * @since JDK 1.8
 */
@ApiModel
@Entity
@Table(name = "`CUSTOMER`")
@EntityListeners(AuditingEntityListener.class)
public class Customer implements Serializable{

	private static final long serialVersionUID = 2528890098805684542L;

	public Customer(){
		
	}
	
	public Customer(String customerName,String customeMobile,String cardCode){
		this.customerName = customerName;
		this.customeMobile = customeMobile;
		this.cardCode = cardCode;
	}
	
	@ApiModelProperty(name = "customerId", value = "客户id", hidden = true)
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "`CUSTOMER_ID`")
	private int customerId;

	@ApiModelProperty(name = "customerName", value = "客户名称", dataType = "String", required = true)
	@NotBlank(message = "客户名称不可为空")
	@Column(name = "`CUSTOMER_NAME`", nullable = false)
	private String customerName;
	
	@ApiModelProperty(name = "customeMobile", value = "客户电话", dataType = "String", required = true)	
	@NotBlank(message = "客户电话不可为空")
	@Pattern(message = "客户电话格式错误",regexp = "^((13[0-9])|(14[579])|(15([0-3]|[5-9]))|(16[6])|(17[0135678])|(18[0-9])|(19[89]))(\\*\\*\\*\\*)\\d{4}$")
	@Column(name = "`CUSTOMER_MOBILE`",nullable = false)
	private String customeMobile;
	
	@ApiModelProperty(name = "cardCode", value = "卡片编码(银行对应编码)", dataType = "String", required = true)	
	@NotBlank(message = "卡片编码不可为空")
	@Column(name = "`CARD_CODE`",nullable = false)
	private String cardCode;
	
	@ApiModelProperty(name = "createdTime",value="创建时间",hidden = true)
	@CreatedDate
	@Column(name = "`CREATEDTIME`", updatable = false, columnDefinition = "bigint(20) DEFAULT 0")
	private long createdTime;

	/**
	 * @return the customerId
	 */
	public int getCustomerId() {
		return customerId;
	}

	/**
	 * @param customerId the customerId to set
	 */
	public void setCustomerId(int customerId) {
		this.customerId = customerId;
	}

	/**
	 * @return the customerName
	 */
	public String getCustomerName() {
		return customerName;
	}

	/**
	 * @param customerName the customerName to set
	 */
	public void setCustomerName(String customerName) {
		this.customerName = customerName;
	}

	/**
	 * @return the customeMobile
	 */
	public String getCustomeMobile() {
		return customeMobile;
	}

	/**
	 * @param customeMobile the customeMobile to set
	 */
	public void setCustomeMobile(String customeMobile) {
		this.customeMobile = customeMobile;
	}

	/**
	 * @return the cardCode
	 */
	public String getCardCode() {
		return cardCode;
	}

	/**
	 * @param cardCode the cardCode to set
	 */
	public void setCardCode(String cardCode) {
		this.cardCode = cardCode;
	}

	/**
	 * @return the createdTime
	 */
	public long getCreatedTime() {
		return createdTime;
	}

	/**
	 * @param createdTime the createdTime to set
	 */
	public void setCreatedTime(long createdTime) {
		this.createdTime = createdTime;
	}

}
